package com.chuanyang.driverh.mainorder;


import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.chuanyang.driverh.R;
import com.chuanyang.driverh.base.BaseTitleActivity;
import com.chuanyang.driverh.mainorder.fragment.PendingOrderFragment;
import com.chuanyang.driverh.utils.eventbus.OrderFinish;

/**
 * 待处理订单
 * Created by eason on 2016/7/14.
 */
public class PendingOrderActivity extends BaseTitleActivity {
    private Fragment mFragment;

    @Override
    protected int getContentResId() {
        return R.layout.base_single_fragment_activity;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        setBackImg();
        getTitleTextView().setText("待处理订单");
    }

    @Override
    protected void initData() {
        if (mFragment == null) {
            mFragment = new PendingOrderFragment();
        }
        getSupportFragmentManager().beginTransaction()
                .add(R.id.single_fragment_content, mFragment).commit();

    }

    @Override
    protected void initListener() {

    }

    /**
     * 通知关闭当前页面   当有新的订单推送来，需要重新加载待处理订单
     *
     * @param event
     */
    public void onEventMainThread(OrderFinish event) {
        if (event.isFinish()) {
            finish();
        }
    }
}
